function dx = system_ode(x, k)
    % 状态变量 x = [x; y; z; u; v]
    dx = zeros(5,1);

    dx(1) = x(2) + x(3) - k * cos(x(5)) * x(2); % \dot{x}
    dx(2) = -x(1) + x(3);                        % \dot{y}
    dx(3) = -x(1) - x(3) + k * cos(x(4)) * x(1); % \dot{z}
    dx(4) = x(1);                               % \dot{u}
    dx(5) = x(2);                               % \dot{v}
end

%% 子函数：RK4一步积分
function x_next = RK4_step(f, x, h)
    k1 = f(x);
    k2 = f(x + h/2 * k1);
    k3 = f(x + h/2 * k2);
    k4 = f(x + h * k3);
    x_next = x + h/6*(k1 + 2*k2 + 2*k3 + k4);
end
